<template>
  <div class="home">
    <div @click="add">cs</div>
    <img alt="Vue logo" src="../assets/logo.png" />
    <HelloWorld msg="Welcome to Your Vue.js App" />
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from "@/components/HelloWorld.vue";
import { mapState, mapMutations, mapActions } from "vuex";

export default {
  name: "HomeView",
  components: {
    HelloWorld,
  },
  computed: {
    ...mapState(["count"]),
  },
  methods: {
    ...mapMutations(["setcount"]),
    ...mapActions(["setcount2"]),
    add() {
      console.log(this.count);
      this.setcount2(this.count + 1);
    },
  },
  watch: {
    count(val) {
      console.log(val, "count");
    },
  },
};
</script>
